package InputOutput;

import java.util.Scanner;

public class Scanner_println {
    public static void main(String[] args) {

//        需求二：从控制台接受关键字，打印出包含该关键的人名
        Scanner scanner = new Scanner(System.in);

        System.out.println("input keywords:");
        String name = scanner.next();

        String[] array_name
                = {"霹雳火", "超音速", "火男", "四手霸王", "五灵威力", "迷糊老师", "波比", "超人强", "小菲菲", "猪猪侠", "小猪猪"};

        for (String a : array_name) {
//            注意a.contains(name)这个name是用户输入的变量，不能打引号
            if (a.contains(name)) {
                System.out.println(a);
            }
        }
        System.out.println("\n");




//        需求三：从控制台接受一个数值，打印出对应长度的人名
        System.out.println("input num:");
        int num = scanner.nextInt();
        for (String a : array_name) {
            if (a.length()==num){
                System.out.println(num+"个字的名字有："+a);
            }
        }
        System.out.println("\n");




//        需求四：从控制台接受一个人名，打印出对应的人名
        System.out.println("input a name:");
        String name04 = scanner.next();
        for (String a : array_name){
            if (a.equals(name04)){
                System.out.println("对应长度的人名:"+a);
            }
        }
        System.out.println("\n");


//        三目运算符

        System.out.println("input a:");
        int a = scanner.nextInt();
        System.out.println("input b:");
        int b= scanner.nextInt();
        System.out.println( (a < b) ? true : false);



    }
}
